<script>
import {listTypeList} from "../../api/dict";

export default {
    name: "MenuLine",
    data(){
        return{
            dataList:[],
        }
    },
    methods:{
        getMenuList(){
            const param={
                code:'resType'
            }
            listTypeList(param)
            .then(res=>{
                if(res.code===200)
                    this.dataList=res.data
            })
        },
        itemClick(id){
            this.$emit('select',id)
        }
    },
    created() {
        this.getMenuList()
    }
}
</script>

<template>
    <div class="flex column left">
        <span class="item"  @click="itemClick({id:0,name:'全部'})">全部</span>
        <span class="item" v-for="i in dataList" @click="itemClick(i)">{{i.name}}</span>
    </div>
</template>

<style scoped>
.left{
    margin-top: 10px;
    background: white;
    padding: 10px 10px;
    height: fit-content;
}
.item{
    cursor: pointer;
    line-height: 30px;
    padding: 0 3px;
    margin: 5px 0;
    font-weight: normal;
    color: #626971;
    font-size: 15px;
    border-radius: 10px;
}
.item:hover{
    background: #d2d2d2;
}
</style>
